package ext.mango.aa.base;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import ext.mango.aa.so.AppManager;
import ext.mango.base.Messages;
import ext.mango.utils.Logger2;
import mango.Mango;
import mango.service.ServiceManager;

public class HttpListener implements ServletContextListener {

    public void contextDestroyed(ServletContextEvent arg0) {
        Mango.close();
    }

    public void contextInitialized(ServletContextEvent arg0) {
        Messages.load();
        Mango.initialize();
        Mango.setLog(Logger2.getLog(Mango.class.getSimpleName()));
        Logger2.start();
        Mango.trace();
        ServiceManager.getService(AppManager.class).init();
    }
}
